﻿@page "/sdk/objects/entity/l/{PageName?}"

@model WebVella.Erp.Plugins.SDK.Pages.ErpEntity.ListModel

@{
	Layout = "~/Pages/_AppMaster.cshtml";
	ViewData["Title"] = "Entities";
	//var titleAction = "<a href=\"javascript:void(0)\" class=\"clear-filter-all\">clear all</a>";
}
<wv-page-header color="#dc3545" area-label="Entities" title="All entities list"
				icon-class="fa fa-database" description="@Model.PageDescription">
	<wv-page-header-actions>
		@foreach (var action in Model.HeaderActions)
		{
			@Html.Raw(action)
		}
	</wv-page-header-actions>
	<wv-page-header-actions-aux>
		<form id="wv-17726e93-fd63-4af2-8754-59bc2f1582c4" class="search-form" name="form" method="get" novalidate="novalidate" autocomplete="on">
			<input class="form-control form-control-sm" id="input-0d0c248a-9027-4b0c-8fa7-bfb411dc4041" name="q_name_v" placeholder="Search in name" type="text" value="@Model.SearchString">
			<input type="hidden" name="q_name_t" value="CONTAINS">
		</form>
	</wv-page-header-actions-aux>
</wv-page-header>

<wv-grid bordered="true" hover="true" columns="Model.Columns" page="Model.Pager" total-count="Model.TotalCount" page-size="Model.PagerSize">
	@foreach (var record in Model.Records)
	{
		<wv-grid-row>
			<wv-grid-column>
				@Html.Raw(record["action"])
			</wv-grid-column>
			<wv-grid-column>
				@Html.Raw(record["icon"])
			</wv-grid-column>
			<wv-grid-column>
				@record["name"]
			</wv-grid-column>
			<wv-grid-column>
				@record["fields"]
			</wv-grid-column>
		</wv-grid-row>
	}
	@if (Model.Records.Count == 0)
	{
		<tbody>
			<tr>
				<td colspan="@Model.Columns.Count"><div class="alert alert-info">No pages found</div></td>
			</tr>
		</tbody>
	}
</wv-grid>
<script>
	window.onload = function(){
		var searchinput = document.getElementById("input-0d0c248a-9027-4b0c-8fa7-bfb411dc4041");
		searchinput.focus();
	}
</script>